<!DOCTYPE html>
<html>

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="stylesheet" href="//cdn.jsdelivr.net/npm/layui@2.6.8/dist/css/layui.css">
    <script src="//cdn.jsdelivr.net/npm/layui@2.6.8/dist/layui.js" charset="utf-8"></script>
    <title>微信支付</title>
</head>

<body>
    <div style="color:#556B2F;margin-top:10px;font-size:16px;font-weight: bolder;text-align: center;">扫描支付模式二</div><br />
    <img alt="模式二扫码支付" src="/buy/createQrImg?data=<?php echo urlencode($url2) ?>" style="width:200px;height:200px;margin: -18px 0 -15px 50px" />
    <div style="color:#ff0000;text-align: center;"><b>微信支付</b></div>
    <script>
        // 定时检查支付状态
        var $ = layui.jquery,
            ord_no = '{$ord_no}',
            count = 0,
            timer = setInterval(() => {
                $.get('/buy/chk_ispay', { ord_no }, function (res) {
                    if (res.code === 0) {
                        layer.alert('支付成功', { icon: 1 });
                        setTimeout(() => parent.window.location.href = '/orders/myorders', 1000);
                    }
                    count += 3000;
                    if (count >= 60000) {
                        clearInterval(timer);
                        parent.layer.close(parent.layer.getFrameIndex(window.name));
                    }
                }, 'json');
            }, 3000);
    </script>
</body>

</html>